//
//  ViewController.m
//  HHHorizontalPagingView
//
//  Created by Huanhoo on 15/7/16.
//  Copyright (c) 2015年 Huanhoo. All rights reserved.
//

#import "ViewController.h"
#import "HHHorizontalPagingView.h"
//#import "HHHeaderView.h"
#import "HHContentTableView.h"
#import "HHContentCollectionView.h"
#import "HHContentScrollView.h"
#import "HeadView.h"

#import "Header.h"
#import "UserInfoModel.h"
#import "WuLiUserWorkReauest.h"

#import "PersonViewController.h"
#import "SetupViewController.h"



#define  UIColorRGBA(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]

#define kWindowWidth                        ([[UIScreen mainScreen] bounds].size.width)

#define kWindowHeight                       ([[UIScreen mainScreen] bounds].size.height)
@interface ViewController ()<PushDelegate>
{
    HHContentTableView *tableView;
}
@property (nonatomic,strong)NSMutableArray *buttonArray;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.navigationController setNavigationBarHidden:YES];
    
    [self.view setBackgroundColor:uicolor(237, 237, 237)];
    
    
    
    HeadView *headView = [[HeadView alloc] initWithFrame:CGRectMake(0, 0, WithView, 70)];
    [headView setUserInteractionEnabled:YES];
    headView.titleNameString = [UserInfoModel nameString];
    headView.FocusOnString = [UserInfoModel starString];
    headView.fansString = [UserInfoModel fllowString];
    headView.imageurl = [UserInfoModel imageString];
    [headView setBackgroundColor:uicolor(255.0, 204.0, 0)];
    headView.delegate = self;
    [self.view addSubview:headView];
    
    tableView           = [HHContentTableView contentTableView];
    HHContentCollectionView *collectionView = [HHContentCollectionView contentCollectionView];
    HHContentScrollView *scrollView = [HHContentScrollView contentScrollView:@"" andRefactor:@"" andComments:@"" andThumbup:@""];
   
   _buttonArray = [NSMutableArray array];
    for(int i = 0; i < 3; i++) {
        UIButton *segmentButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [segmentButton setBackgroundImage:[UIImage imageNamed:@"pointyellow"] forState:UIControlStateNormal];
        [segmentButton setBackgroundImage:[UIImage imageNamed:@"pointbai"] forState:UIControlStateSelected];

        [segmentButton setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
        [_buttonArray addObject:segmentButton];
        [segmentButton setBackgroundColor:UIColorRGBA(255.0, 247.0, 217.0, 1)];
    
    }
    HHHorizontalPagingView *pagingView = [HHHorizontalPagingView pagingViewWithHeaderView:headView headerHeight:141.f segmentButtons:_buttonArray segmentHeight:42 contentViews:@[collectionView, tableView, scrollView]];
    pagingView.textArray = @[@"收藏", @"作品", @"消息"];
    pagingView.segmentButtonSize = CGSizeMake(kWindowWidth/3.0, 42);              //自定义segmentButton的大小
    
//    pagingView.segmentView.backgroundColor = [UIColor grayColor];     //设置segmentView的背景色
    
    //设置需放大头图的top约束
    /*
    pagingView.magnifyTopConstraint = headerView.headerTopConstraint;
    [headerView.headerImageView setImage:[UIImage imageNamed:@"headerImage"]];
    [headerView.headerImageView setContentMode:UIViewContentModeScaleAspectFill];
     */
    
    [self.view addSubview:pagingView];
    
}

- (void)TouchPlush{
    
    PersonViewController *personview = [[PersonViewController alloc] init];
    [self.navigationController pushViewController:personview animated:YES];


}

- (void)TouchSetEvent{

    SetupViewController *SetView = [[SetupViewController alloc] init];
    [self.navigationController pushViewController:SetView animated:YES];
    
}



- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.tabBarController setHidesBottomBarWhenPushed:NO];
    
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
//    [self.tabBarController setHidesBottomBarWhenPushed:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}






//获得用户收藏
- (void)getUserCollectWorkGetBack:(NSNotification *)notion
{
    NSDictionary *dic = [notion userInfo];
    if ([[dic valueForKey:@""] intValue] == 1)
    {
        
    }
}


@end
// 版权属于原作者
// http://code4app.com (cn) http://code4app.net (en)
// 发布代码于最专业的源码分享网站: Code4App.com